<template>
    <div class="Auth">
        <hb-title :title="Lang.authText[lang][0]" />
        <c-box v-show="!isAuth" :formTitle="Lang.authText[lang][1]" :cardTitle="Lang.authText[lang][5]" :nameTitle="Lang.authText[lang][2]" :idTitle="Lang.authText[lang][3]" :btnTitle="Lang.authText[lang][4]" :name="Lang.authText[lang][5]" />
        <c-authed v-show="isAuth" :authName='authName' :authID='authID'/>
    </div>
</template>

<script>
import Box from './box/a.vue'
import Authed from './authed/a.vue'
import Lang from './lang.js'
import {vpost, vlink} from '@api'
export default {
	name: 'Auth',
	data() {
		return {
			Lang,
			langSelects: [{value: 0, txt: '简体中文'}, {value: 1, txt: 'English'}],
			isAuth: false,
			authName: '',
			authID: '',
		}
	},
	computed: {
		lang() {
			return this.$store.state.setting.lang
		},
	},
	components: {
		'c-box': Box,
		'c-authed': Authed,
	},
	methods: {
		// 检测是否实名
		checkISAuthed() {
			let inputdate={
				id : this.$store.state.user.uid,
			}
			vpost(vlink.authed, inputdate).then(re => {
				console.log(re,re)
				if (re.status == 1) {
                    this.isAuth = true
                    this.authName = re.data.realName
                    this.authID = re.data.identityNo
				} else if (re.status == 0) {
					this.isAuth = false
				}
			})
		},
	},
	mounted() {
		// 检查是否实名
		this.checkISAuthed()
	},
}
</script>

<style scoped>
.Auth {
	margin: 40px auto;
	width: 1200px;
}
</style>


